package com.addcn.caruimodule.click;

import android.view.View;

/**
 * Created by 10528 on 2018/6/11.
 */

public class SingleClickListener implements View.OnClickListener{
    private long lastTime=-1;
    private View.OnClickListener listener;

    public SingleClickListener(View.OnClickListener listener){
        this.listener=listener;
    }

    @Override
    public void onClick(View v) {
        if(lastTime==-1||System.currentTimeMillis()-lastTime>5000){
            listener.onClick(v);
            lastTime=System.currentTimeMillis();
        }
    }
}
